<template>
  <div>
    <!-- 最上面 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>商品管理</el-breadcrumb-item>
      <el-breadcrumb-item>添加商品</el-breadcrumb-item>
    </el-breadcrumb>

    <!-- 卡片视图区域 -->
    <el-card>
      <!-- 头部提示 -->
      <el-alert
        title="添加商品信息"
        type="info"
        center
        show-icon
        :closable="false"
      >
      </el-alert>

      <!-- 步骤条 -->
      <el-steps
        :active="active - 0"
        finish-status="success"
        space="200px"
        align-center
        style="margin-top: 25px"
      >
        <el-step title="基本信息"></el-step>
        <el-step title="商品参数"></el-step>
        <el-step title="商品属性"></el-step>
        <el-step title="商品图片"></el-step>
        <el-step title="商品内容"></el-step>
        <el-step title="完成"></el-step>
      </el-steps>

      <!-- 标签页 -->
      <el-form
        :model="goodsForm"
        :rules="goodsRules"
        ref="goodsForm"
        label-width="100px"
        class="demo-ruleForm"
        label-position="top"
      >
        <el-tabs
          tab-position="left"
          v-model="active"
          style="height: 200px;margin-top: 15px"
        >
          <el-tab-pane label="基本信息" name="0">
            <!-- 栏目一内容 -->
            <el-form-item label="商品名称" prop="goods_name">
              <el-input
                v-model="goodsForm.goods_name"
                style="width: 100%"
              ></el-input>
            </el-form-item>
            <el-form-item label="商品价格" prop="goods_price">
              <el-input
                v-model="goodsForm.goods_price"
                style="width: 100%"
              ></el-input>
            </el-form-item>
            <el-form-item label="商品重量" prop="goods_weight">
              <el-input
                v-model="goodsForm.goods_weight"
                style="width: 100%"
              ></el-input>
            </el-form-item>
          </el-tab-pane>
          <el-tab-pane label="商品参数" name="1">商品参数</el-tab-pane>
          <el-tab-pane label="商品属性" name="2">商品属性</el-tab-pane>
          <el-tab-pane label="商品图片" name="3">商品图片</el-tab-pane>
          <el-tab-pane label="商品内容" name="4">商品内容</el-tab-pane>
        </el-tabs>
      </el-form>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      //控制当前选中步骤条
      active: "0",
      //商品表单
      goodsForm: {
        goods_name: "",
        goods_price: "",
        goods_weight: ""
      },
      //验证规则
      goodsRules: {
        goods_name: [
          { required: true, message: "请输入商品名称", trigger: "blur" }
        ]
      }
    };
  },
  created() {},
  methods: {
    next() {
      if (this.active++ > 5) this.active = 0;
    }
  }
};
</script>

<style lang="less"></style>
